//
//  LanguageSelectCell.m
//  X-Touch2
//
//  Created by shengchao yang on 12-4-19.
//  Copyright (c) 2012年 foxhis. All rights reserved.
//

#import "LanguageSelectCell.h"
#import "LanguageSelectCellController.h"
#import "FileManager.h"

@implementation LanguageSelectCell

- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        LanguageSelectCellController *cellController = [[[LanguageSelectCellController alloc] initWithNibName:@"LanguageSelectCellController" bundle:nil] autorelease];
        [self.contentView addSubview:cellController.view];
        
        lblLang = (UILabel *)[self viewWithTag:TagOfUILabel];
        imgLang = (UIImageView *)[self viewWithTag:TagOfUIImageView];
    }
    return self;
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated{
    [super setSelected:selected animated:animated];
}

-(void) setData:(id)data{
    NSString * temp = (NSString *)data;
    imgLang.image = [FileManager getImage:[NSString stringWithFormat:@"lang_%@.png",temp] type:3 withRect:imgLang.frame]; 
    if ([temp isEqualToString:@"zh-Hans"]) {
        lblLang.text = @"简体中文";
    }else if([temp isEqualToString:@"zh-Hant"]){
        lblLang.text = @"繁體中文";
    }else if([temp isEqualToString:@"en"]){
        lblLang.text = @"English";
    }else if([temp isEqualToString:@"ja"]){//日语
        lblLang.text = @"日语";
    }else if([temp isEqualToString:@"ko"]) {//韩语
        lblLang.text = @"한국의";
    }else if([temp isEqualToString:@"ru"]) {//俄语
        lblLang.text = @"русский";
    }else if([temp isEqualToString:@"fr"]) {//法语
        lblLang.text = @"français";
    }
}

-(void) dealloc{
    [super dealloc];
}
@end
